#pragma once
#define _CRT_SECURE_NO_WARNINGS 1


#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>

typedef int STDataType;
typedef class Stack
{
	STDataType* data;
	int top;
	int capacity;
public:
	void Init(int DefaultCapacity = 5);
	
	void Push(STDataType x);
	void Pop()
	{
		assert(top);
		top--;
	}

	void Destroy()
	{
		assert(capacity);
		free(data);
		top = capacity = 0;
	}

	STDataType Top()
	{
		assert(capacity);
		return data[top - 1];
	}
	bool Empty()
	{
		assert(capacity);
		return top == 0;
	}

}ST;
